package com.os.opencv.java.chapter9;

import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.highgui.HighGui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;

public class Canny {

    public static void main(String[] args) {
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        //读取图像并在屏幕上显示
        Mat src = Imgcodecs.imread("/Users/matt/Pictures/WechatIMG1777.jpg");
        HighGui.imshow("wanlifuwangshi", src);
        HighGui.waitKey(0);

        //进行canny边缘检测并在屏幕上显示
        Mat dst = new Mat();
        Imgproc.GaussianBlur(src, src, new Size(3,3), 5);
        Imgproc.Canny(src, dst, 60, 200);
        HighGui.imshow("canny", dst);
        HighGui.waitKey(0);

        System.exit(0);
    }
}
